package com.itxckf.service.impl;

import com.itxckf.mapper.RoleMapper;
import com.itxckf.pojo.Role;
import com.itxckf.pojo.RolePath;
import com.itxckf.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    private RoleMapper roleMapper;
    @Override
    public List<Role> getRole() {
        return roleMapper.getRole();
    }

    @Override
    public List<RolePath> getUserRole(Short id) {
        return roleMapper.getUserRole(id);
    }

    @Override
    public List<RolePath> getPaths() {
        return roleMapper.getPaths();
    }

    @Override
    public void addPath(RolePath rolePath) {
        roleMapper.addPath(rolePath);
    }

    @Override
    public void deletePath(Short id) {
        roleMapper.deletePath(id);
    }

    @Override
    public void editUserRole(Short roleID,List<Short> newIds) {
        roleMapper.deleteUserRole(roleID);
        roleMapper.editUserRole(roleID,newIds);
    }

    @Override
    public void editPath(RolePath rolePath) {
        roleMapper.editPath(rolePath);
    }
}
